﻿using Grow.Domain.Object;
using Grow.Domain.Repository.CreateDomainRepository;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Grow.Repository.EntityFrameworkCore.CreateRepository
{
    public class EntityPropertyBuilder<TEntity, TProperty> : IEntityPropertyBuilder<TEntity, TProperty>
         where TEntity : class, IEntity
    {
        private readonly PropertyBuilder<TProperty> _propertyBuilder;

        public EntityPropertyBuilder(PropertyBuilder<TProperty> propertyBuilder)
        {
            _propertyBuilder = propertyBuilder;
        }

        public IEntityPropertyBuilder<TEntity, TProperty> HasComment(string comment)
        {
            _ = _propertyBuilder.HasComment(comment);
            return this;
        }

        public IEntityPropertyBuilder<TEntity, TProperty> HasMaxLength(int maxLength)
        {
            _ = _propertyBuilder.HasMaxLength(maxLength);

            return this;
        }

        public IEntityPropertyBuilder<TEntity, TProperty> HasPrecision(int precision, int scale)
        {
            _ = _propertyBuilder.HasPrecision(precision, scale);
            return this;
        }

        public IEntityPropertyBuilder<TEntity, TProperty> HasPrecision(int precision)
        {
            _ = _propertyBuilder.HasPrecision(precision);
            return this;
        }
    }
}
